Isolation for applications working on shared XML data

ABSTRACT

A mechanism is provided for detecting and disregarding application specific nodes contained in shared XML documents. The techniques described involve determining one or more application specific nodes within XML documents and performing path expression evaluations of the XML documents as if the nodes are not present. In one embodiment, a mechanism is provided by which a user may specify the criterion that determines which subset of nodes in XML documents are to be ignored from path expression evaluations. A query that specifies a path operation based on a path is evaluated ignoring said identified nodes when evaluating said path operation.

RELATED APPLICATION

This application is related to U.S. patent application Ser. No. 11/401,613, filed on Apr. 10, 2006 entitled A Mechanism for Improving Performance on XML Over XML Data Using Path Subsetting, filed by Asha Tarachandani, the contents of which are herein incorporated by reference in their entirety for all purposes.

FIELD OF THE INVENTION

The present invention relates to processing XML data, and in particular, processing XML related operations on shared XML data.

BACKGROUND OF THE INVENTION

The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.

The Extensible Markup Language (XML) is a widely accepted standard for data and documents in the computer industry. XML describes and provides structure to a body of data, such as a file or data packet. The XML standard provides for tags that delimit sections of a XML entity referred to as XML elements. The following XML document A illustrates the components of an XML document.

XML document A <a c=“foo”>  <b>3</b>  <d>10</d> </a>

XML elements are delimited by a start tag and a corresponding end tag. For example, segment A contains the start tag <b> and the end tag </b> to delimit an element. The data between the elements is referred to as the element's content. The name of the element delimited by <b> and the end tag </b> is b and is thus referred to herein as element b or just b.

An element's content may include the elements value, one or more attributes, and one or more elements. Element a contains two elements b and d. An element that is contained by another element is referred to as a descendant of that element. Thus, elements b and d are descendants of element a. An element's attributes are also referred to as being contained by the element.

Database servers that store XML documents perform various XML related operations on the XML documents using XML query languages, such as XQuery/XPath. XML Query Language (“XQuery”) and XML Path Language (“XPath”) are important standards for a query language, which can be used in conjunction with SQL to express a large variety of useful queries. XPath is described in XML Path Language (XPath), version 1.0 (W3C Recommendation 16 Nov. 1999), which is incorporated herein by reference.

One benefit of storing XML documents in a database system is that XML allows multiple applications to perform operations using the same XML documents. This requires that the XML data be general enough to be understood by all applications that share XML documents. However, in many cases, there is a need to include application specific information in the XML document. Application specific information is data contained within the XML document that is only used, needed, and/or recognized by less than all applications for which the XML document is being maintained or made accessible.

Including application specific information in a shared XML document poses a significant problem because multiple applications are using the same XML document and not all of the applications can identify, handle, and recognize the application specific information. For purposes of explanation consider the following XML document:

Article1.xml <Article xmlns= “http://www.mycompany.com” Xmlns:fmt=http://www.mycompany.com/format”>  <fmt:justified>   <Date> January 01, 2001 </Date>   <Title> My title </Title>   <Author> John <fmt:italic> Jonathan </fmt:italic>   Doe </Author>   <Text>    ............... <fmt:bold> This is Important    </fmt:bold> ......   </Text>  </fmt:justified> </Article>

Consider two applications that share the XML document Article1.xml. Application 1 is responsible for displaying the article content and Application 2 is a tool for searching the article content. Application 1 inserted the following formatting information into Article1.xml: <fmt:justified>, <fmt:italic>, and <fmt:bold>. The formatting information is useless to Application 2, which performs search queries on the Article content. When Application 2 requests to return all article titles for articles written by Jonathan, Application 2 may use in an XPath query a path expression like ‘/Articles/Title and/Articles/Author’. The formatting information inserted by Application 1 poses two significant problems for path expression evaluation.

The first problem is that the path expression leading to the Title and Author elements changes with the addition or deletion of formatting information. The second problem occurs when formatting information is introduced into the leaf nodes of the XML document. If formatting information is added into the leaf nodes, they no longer remain leaf nodes and hence, text-search on the value of that node changes. For, example in the above document, a search for articles where author name matches “John Jonathan Doe” will not return the above document due to the formatting information contained in the Author node.

In addition, the problems described above involving path expression also hinders the ability and benefit of creating an index on XML documents that contain application specific information.

Based on the foregoing, there is a clear need to develop approaches for isolating nodes within a shared collection of XML documents and perform path operations with the XML data as if those nodes are not present.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:

FIG. 1 is a flow diagram showing the steps taken during query evaluation that uses an in-memory representation of the XML document according to an embodiment of the present invention.

FIG. 2 is a flow diagram showing the step taken during query evaluation that uses indexes of XML document according to an embodiment of the present invention.

FIG. 3 is a block diagram of a computer system that may used to implement an embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of various embodiments of the invention. It will be apparent, however, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention.

Functional Overview

A mechanism is provided for detecting and disregarding specified nodes contained in shared XML documents. The mechanism may be used regardless of the format and data structures used to store the actual XML data (the “base structures”). For example, the actual XML data can reside in structures within or outside of a database, in any form, such as CLOB (character LOB storing the actual XML text), O-R (object-relational structured formed according to a schema, such as an XML schema), or BLOB (binary LOB storing some binary form of the XML).

The techniques described herein involve a mechanism for specifying and determining one or more nodes within XML documents to ignore and performing operations on the XML documents as if the nodes are not present. In one embodiment, a mechanism is provided by which a user may specify the criterion that determine which subset of nodes in XML documents are to be ignored from path expression evaluations.

Hierarchy Nature of XML Data

XML documents are represented as a hierarchy of nodes that reflects the XML documents hierarchical nature. The structure of an XML document establishes parent-child relationships between the nodes within the XML document. A hierarchy of nodes is composed of nodes at multiple levels. Each node at a level below the top level is a child node of one or more of the parent nodes at the level above. Nodes at the same level are siblings. A node that has no parent node linked to it is the root node, and a node that has no child nodes linked to it is a leaf node. The “path” for a node in an XML document reflects the series of parent-child links, starting from a “root” node, to arrive at the particular node.

For the purpose of explanation, consider the following XML document:

Po1.xml <PurchaseOrder>  <Reference>ABEL-20021127121040897PST</Reference>  <Actions>   <Action>    <User>ZLOTKEY</User>   </Action>   <Action>    <User>KING</User>   </Action>  </Actions> . . . . </PurchaseOrder>

The path to the “User” node in po1.xml is /PurchaseOrder/Actions/Action/User, since the “User” node is a child of the “Action” node, the “Action” node is a child of the “Actions” node, and the “Actions” node is a child of the “PurchaseOrder” node. PurchaseOrder is the root node.

Example XML Document

For the purpose of explanation, examples shall be given hereafter with reference to the following XML document:

Article1.xml <Article xmlns= “http://www.mycompany.com” Xmlns:fmt=http://www.mycompany.com/format”>  <fmt:justified>   <Date> January 01, 2001 </Date>   <Title> My title </Title>   <Author> John <fmt:italic> Jonathan </fmt:italic>   Doe </Author>   <Text>    ............... <fmt:bold> This is Important    </fmt:bold> ......   </Text>  </fmt:justified> </Article>

Isolating Nodes Within an XML Document

According to one embodiment, a mechanism is provided by which a user may specify criteria that specifies nodes of XML documents that are to be ignored during query evaluation. Specifically, a user may register criteria in the form of XML tags that identify nodes of an XML document that are to be excluded from query evaluation.

In one embodiment of the invention, the techniques described herein are used to specify and determine nodes within an XML document that correspond to Application specific information. By isolating the nodes corresponding to the application specific information, applications that do not use or recognize the application specific information can ignore and handle the XML documents as if those nodes are not present.

According to one embodiment, an initial registration of the nodes to ignore can be specified at the time a query is submitted. Alternatively, the nodes to ignore can be specified beforehand for an entire application. The user specifies the excluded nodes by identifying which tags of the XML document are “futile” to a particular query (hereinafter referred to as futile-tags). The one or more futile-tags are used to exclude fragments of XML documents that are known to be useless from a query standpoint.

For example, in Article1.xml the tag </fmt:italic> provides document formatting information. The formatting tag may only be useful to an application that displays the document content. For an application that runs a search on Article1.xml to return all article titles for articles written by Jonathan the formatting tags are useless and hinder the evaluation of the XPath query /Articles/Title and /Articles/Author.

By ignoring specified nodes from XML documents, multiple applications can use the same XML document and perform XPath expression evaluation even when the XML document contains portions of information only applicable to another application. Accordingly, in the above example, both the formatting application and the searching application can use the same XML document Article1.xml without the problems imposed by the formatting information.

According to one embodiment, futile-tags are specified based on a namespace. For example, in Article1.xml the tag </fmt:justified> has a namespace “fmt” indicating it is a formatting namespace. The user may specify that all tags in that namespace are considered futile and should be ignored when performing a query.

For example, in the XML document Article1.xml, assume that Application 1 has inserted the various formatting tags <fmt:justified>, <fmt:italic>, and <fmt:bold> throughout the XML document. If the formatting tags are useless to Application 2 the user can indicate that for Application 2 that “fmt” tag namespace tags are futile-tag for query evaluation.

In addition to using namespaces to indicate futile-tags, a user may also specify specific tags corresponding to nodes of the XML document that are to be excluded from query evaluation.

In yet another embodiment, query evaluation supports the building of indexes on XML data. When indexes are built and used for query evaluation, a registration of the nodes to ignore is specified at the time of index creation. The indexes will be built excluding the nodes to ignore as indicated by the futile-tags; no nodes corresponding to a futile-tag are added to the indexes

Ignoring Node During XPath Query Evaluation

In one embodiment, an application query that has one or more futile-tags indicated performs the query evaluation as if those tags were never present in the XML documents. Specifically, a query engine will ignore the nodes within the XML document indicated by the futile-tags when evaluating the query.

In one embodiment, the query engine constructs an in-memory representation of the XML document before processing the query. When the in-memory representation is constructed, the XML document is parsed and each node indicated by a futile tag is excluded from the in-memory representation of the XML document. Upon completion of the in-memory representation, the query is evaluated based on the in-memory representation, thereby evaluating the query as if the excluded nodes were never in the original XML document.

FIG. 1 illustrates the steps taken when evaluating a query, which employs an in-memory representation. In step 102, the XML document is retrieved. In step 104, the XML document from step 102 is parsed and a node is extracted from the XML document. Once the node is extracted, the node is compared to the user specified futile-tags to determine if there is a match in step 106. If there is a match between the node and one of the futile-tags, the node is excluded from the in-memory representation in step 108. However, if the node does not match any of the futile-tags, then the node is added to the in-memory representation of the XML document in step 110. In step 112, a determination is made as to whether there are remaining nodes in the XML document to be parsed. If there are remaining nodes, then steps, 104-112 are repeated until the entire XML document has been parsed. In step 114, once the XML document has been parsed and an in-memory representation completed, the query can be executed. Finally, in step 116, the results of the query are returned to the application.

In another embodiment of the invention, the query engine performs streaming-XPath query evaluation. Streaming XPath evaluation performs the query evaluation based directly on the original XML document. No index or in-memory representation of the XML document is used in streaming XPath evaluation. When streaming XPath evaluation is used, the query engine itself will determine and exclude nodes based on the specified futile-tags during the XPath evaluation.

In yet another embodiment of the invention, the query engine employs indexes on XML documents to perform the query evaluation. When the query engine uses an index, it is preferable that the futile tags are specified at the time of index creation. Providing the futile tags at the time of index creation allows any futile tags within current and future XML documents to be ignored at the time they are inserted into the index. When the query engine evaluates the query using the indexes the excluded nodes, will not appear in the indexes and thus, the query is executed as if the excluded nodes where never in the original XML document.

In FIG. 2, the steps taken to evaluate a query which employs indexes on the XML documents is shown. The steps are very similar to those with respect to FIG. 1 except that the nodes are added or excluded from the indexes instead of the in-memory representation of the XML document. In step 202, the XML document is retrieved. In step 104, the XML document from step 202 is parsed and a node is extracted from the XML document. Once the node is extracted, in step 206, the node is compared to the user specified futile tags to determine if there is a match. If there is a match between the node and one of the futile tags, the node is excluded from the indexes in step 208. However, if the node does not match any of the futile tags, then the node is added to the indexes in step 210. In step 212, a determination is made as to whether there are remaining nodes in the XML document to be parsed. If there are remaining nodes, then steps 204-212 repeat until the entire XML document has been parsed. Once the index is complete, queries can be executed 214 using the index and returned to the application 216.

Creating an XML index and using the XML index to answer XPath queries is described in U.S. patent application Ser. No. 10/884,311, entitled XML INDEX FOR ACCESSING XML DATA, filed on Jul. 2, 2004 which is incorporated herein by reference.

Hardware Overview

FIG. 3 is a block diagram that illustrates a computer system 300 upon which an embodiment of the invention may be implemented. Computer system 300 includes a bus 302 or other communication mechanism for communicating information, and a processor 304 coupled with bus 302 for processing information. Computer system 300 also includes a main memory 306, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 302 for storing information and instructions to be executed by processor 304. Main memory 306 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor 304. Computer system 300 further includes a read only memory (ROM) 308 or other static storage device coupled to bus 302 for storing static information and instructions for processor 304. A storage device 310, such as a magnetic disk or optical disk, is provided and coupled to bus 302 for storing information and instructions.

Computer system 300 may be coupled via bus 302 to a display 312, such as a cathode ray tube (CRT), for displaying information to a computer user. An input device 314, including alphanumeric and other keys, is coupled to bus 302 for communicating information and command selections to processor 304. Another type of user input device is cursor control 316, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 304 and for controlling cursor movement on display 312. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.

The invention is related to the use of computer system 300 for implementing the techniques described herein. According to one embodiment of the invention, those techniques are performed by computer system 300 in response to processor 304 executing one or more sequences of one or more instructions contained in main memory 306. Such instructions may be read into main memory 306 from another computer-readable medium, such as storage device 310. Execution of the sequences of instructions contained in main memory 306 causes processor 304 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.

The term “computer-readable medium” as used herein refers to any medium that participates in providing instructions to processor 304 for execution. Such a medium may take many forms, including but not limited to, non-volatile media, volatile media, and transmission media. Non-volatile media includes, for example, optical or magnetic disks, such as storage device 310. Volatile media includes dynamic memory, such as main memory 306. Transmission media includes coaxial cables, copper wire, and fiber optics, including the wires that comprise bus 302. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications.

Common forms of computer-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any other memory chip or cartridge, a carrier wave as described hereinafter, or any other medium from which a computer can read.

Various forms of computer readable media may be involved in carrying one or more sequences of one or more instructions to processor 304 for execution. For example, the instructions may initially be carried on a magnetic disk of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 300 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 302. Bus 302 carries the data to main memory 306, from which processor 304 retrieves and executes the instructions. The instructions received by main memory 306 may optionally be stored on storage device 310 either before or after execution by processor 304.

Computer system 300 also includes a communication interface 318 coupled to bus 302. Communication interface 318 provides a two-way data communication coupling to a network link 320 that is connected to a local network 322. For example, communication interface 318 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 318 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 318 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.

Network link 320 typically provides data communication through one or more networks to other data devices. For example, network link 320 may provide a connection through local network 322 to a host computer 324 or to data equipment operated by an Internet Service Provider (ISP) 326. ISP 326 in turn provides data communication services through the world wide packet data communication network now commonly referred to as the“Internet” 328. Local network 322 and Internet 328 both use electrical, electromagnetic, or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 320 and through communication interface 318, which carry the digital data to and from computer system 300, are exemplary forms of carrier waves transporting the information.

Computer system 300 can send messages and receive data, including program code, through the network(s), network link 320, and communication interface 318. In the Internet example, a server 330 might transmit a requested code for an application program through Internet 328, ISP 326, local network 322, and communication interface 318.

The received code may be executed by processor 304 as it is received, and/or stored in storage device 310, or other non-volatile storage for later execution. In this manner, computer system 300 may obtain application code in the form of a carrier wave.

In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. Thus, the sole and exclusive indicator of what is the invention, and is intended by the applicants to be the invention, is the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction. Any definitions expressly set forth herein for terms contained in such claims shall govern the meaning of such terms as used in the claims. Hence, no limitation, element, property, feature, advantage, or attribute that is not expressly recited in a claim should limit the scope of such claim in any way. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense. 

What is claimed is:
 1. A method for isolating application specific information in XML data, the method comprising the steps of: receiving one or more criteria that identifies nodes within a collection of XML documents to ignore; receiving a query that specifies a path operation based on a path; wherein one or more of said identified nodes is under said path; and based at least on the one or more criteria, computing the path operation as if one or more of said identified nodes is not in the collection of XML documents; wherein the method is performed by one or more computing devices.
 2. The method of claim 1, further comprising the step of generating a representation of the collection of XML documents wherein the representation does not contain the nodes identified by the one or more criteria.
 3. The method of claim 2, wherein the step of generating a representation of the collection of XML documents comprises the steps of: parsing the collection of XML documents; and excluding one or more nodes within the collection of XML documents from the representation wherein the one or more nodes within the collection of XML documents is identified by the one or more criteria.
 4. The method of claim 1, further comprising the step of generating an index of the collection of XML documents, wherein the index does not contain one or more nodes identified by the one or more criteria.
 5. The method as recited in claim 4, wherein the one or more criteria is based on criteria identifying one or more tags within the collection of XML documents.
 6. The method of claim 4, wherein the one or more criteria is based on criteria identifying a namespace within the collection of XML documents.
 7. The method of claim 1, wherein the one or more criteria that identifies nodes within a collection of XML documents to ignore is based on a namespace.
 8. The method of claim 1, wherein the collection of XML documents is maintained by a database system.
 9. The method of claim 1, wherein the collection of XML documents includes documents stored in at least one of a BLOB, CLOB, or object-relational structure.
 10. A method for isolating application specific information using shared XML data, the method comprising the steps of: receiving, for a first application, one or more criteria that identifies nodes within a collection of XML documents to ignore; receiving, from the first application, a query that specifies a path operation based on a path; wherein one or more of said identified nodes is under said path; based at least on the one or more criteria, computing the path operation as if one or more of said identified nodes is not in the collection of XML documents; receiving, from a second application, one or more operations to perform on the collection of XML documents; and processing the one or more operations without ignoring the nodes identified by one or more criteria; wherein the method is performed by one or more computing devices.
 11. A non-transitory computer-readable medium storing one or more sequences of instructions which, when executed by one or more processors, causes the one or more processors to isolate application specific information in XML data at least in part by causing: receiving one or more criteria that identifies nodes within a collection of XML documents to ignore; receiving a query that specifies a path operation based on a path; wherein one or more of said identified nodes is under said path; and based at least on the one or more criteria, computing the path operation as if one or more of said identified nodes is not in the collection of XML documents.
 12. The non-transitory computer-readable medium of claim 11, wherein the one or more sequences of instructions, when executed, further cause generating a representation of the collection of XML documents wherein the representation does not contain the nodes identified by the one or more criteria.
 13. The non-transitory computer-readable medium of claim 12, wherein the one or more sequences of instructions, when executed, cause generating a representation of the collection of XML documents at least in part by: parsing the collection of XML documents; and excluding one or more nodes within the collection of XML documents from the representation wherein the one or more nodes within the collection of XML documents is identified by the one or more criteria.
 14. The non-transitory computer-readable medium of claim 11, wherein the one or more sequences of instructions, when executed, further cause generating an index of the collection of XML documents, wherein the index does not contain one or more nodes identified by the one or more criteria.
 15. The non-transitory computer-readable medium of claim 14, wherein the one or more criteria is based on criteria identifying one or more tags within the collection of XML documents.
 16. The non-transitory computer-readable medium of claim 14, wherein the one or more criteria is based on criteria identifying a namespace within the collection of XML documents.
 17. The non-transitory computer-readable medium of claim 11, wherein the one or more criteria that identifies nodes within a collection of XML documents to ignore is based on a namespace.
 18. The non-transitory computer-readable medium of claim 11, wherein the collection of XML documents is maintained by a database system.
 19. The non-transitory computer-readable medium of claim 11, wherein the collection of XML documents includes documents stored in at least one of a BLOB, CLOB, or object-relational structure.
 20. A non-transitory computer-readable medium storing one or more sequences of instructions which, when executed by one or more processors, causes the one or more processors to isolate application specific information using shared XML data at least in part by causing: receiving, for a first application, one or more criteria that identifies nodes within a collection of XML documents to ignore; receiving, from the first application, a query that specifies a path operation based on a path; wherein one or more of said identified nodes is under said path; based at least on the one or more criteria, computing the path operation as if one or more of said identified nodes is not in the collection of XML documents; receiving, from a second application, one or more operations to perform on the collection of XML documents; and processing the one or more operations without ignoring the nodes identified by one or more criteria. 